#pragma once

#include<string>
#include<string.h>
#include<iostream>
#include<assert.h>
using namespace std;
namespace xyc
{
	class string
	{
	public:
		typedef char* iterator;
		typedef const char* const_iterator;
		iterator begin();
		iterator end();
		iterator begin() const;
		iterator end() const;

		string(const char* str = "\0");
		~string();
		const char* c_str() const;
		char& operator[](size_t i);
		const char& operator[](size_t i) const;
		size_t size() const;

		void reserve(size_t n);

		void push_back(char ch);
		void append(const char* str);
		string& operator+=(char ch);
		string& operator+=(const char* str);
		
	private:
		char* _str;
		size_t _size;
		size_t _capacity;

	};
	ostream& operator<<(ostream& out, string& s);
}